<html>
<head>
    <script type="text/javascript" language="javascript">
        function validasi() {
            var answer = document.getElementById("answer").value;
            var question = document.getElementById("question").value;

            if (question == "" || question == null) {
                err.innerHTML = "Please insert the question!";
                return false;

            }
            else if (answer == "" || answer == null) {
                err.innerHTML = "Please insert the answer!";
                return false;
            }
            else {
                return true;
            }

        }
    </script>
</head>
<body>
<form action="doEditWritingGames.jsp" method="post" onsubmit="return validasi()">
    <table>
        <div id="popup-header">
            <h2>Edit Question's Details</h2>
        </div>
        <tr>
            <td colspan="3">Question's Type : Writing</td>

        </tr>

        <%
            rs = stat.executeQuery("select * from DetailGames where detailGamesID = '" + idnya + "' ");
            while (rs.next()) {
                String queID = rs.getString("detailGamesID");
                String pert = rs.getString("Question");
                String ans = rs.getString("Answer");
        %>
    </table>
    <table id="word1">
        <tr>
            <td>Question</td>
            <td>:</td>
            <td><textarea name="question" id="question"><%=pert%>
            </textarea></td>
            <input type="hidden" name="queID" id="queID" value="<%=queID%>">
        </tr>
        <tr>
            <td>Answer</td>
            <td>:</td>
            <td><input type="text" name="answer" id="answer" value="<%=ans%>"></td>
        </tr>
        <tr id="warning">

            <td colspan="3">
                <div id="err"></div>
            </td>
        </tr>
        <tr align="right">
            <td colspan="3">
                <div class="btn-fld">
                    <button type="submit">Save</button>
                </div>

            </td>
        </tr>

        <%}%>
    </table>
</form>
</body>
</html>